/***********************************************
 This file is part of redia-lib-utils-ios
 
 
 Copyright (c) 2015 Redia A/S
 
 Redia-library-app-ios is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 Redia-library-app-ios is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with redia-library-app-ios.  If not, see <http://www.gnu.org/licenses/>.
 
 *********************************************** */
#define JSONEncodingErrorKeyNotFound 1
#define JSONEncodingErrorTypeMismatch 2

#import <Foundation/Foundation.h>
#import "JSONEncoding.h"

@interface JSONEncodingHelperMethods : NSObject

+ (id)parseObjectOfClass:(Class<JSONEncoding>)objectClass withKey:(NSString*)key fromJsonObject:(NSDictionary*)JsonObj;
+ (id)parseObjectOfClass:(Class<JSONEncoding>)objectClass fromJsonObject:(id)JsonObj;
+ (NSInteger)parseIntegerWithKey:(NSString*)key fromJsonObject:(NSDictionary*)JsonObj;
+ (NSInteger)parseIntegerWithKey:(NSString *)key fromJsonObject:(NSDictionary *)JsonObj error:(NSError**)error;
+ (NSInteger)parseIntegerWithKey:(NSString *)key fromJsonObject:(NSDictionary *)JsonObj acceptNull:(BOOL)acceptNull error:(NSError**)error;
+ (float)parseFloatWithKey:(NSString *)key fromJsonObject:(NSDictionary *)JsonObj;
+ (float)parseFloatWithKey:(NSString *)key fromJsonObject:(NSDictionary *)JsonObj error:(NSError**)error;
+ (double)parseDoubleWithKey:(NSString *)key fromJsonObject:(NSDictionary *)JsonObj;
+ (double)parseDoubleWithKey:(NSString *)key fromJsonObject:(NSDictionary *)JsonObj error:(NSError**)error;
+ (BOOL)parseBoolWithKey:(NSString*)key fromJsonObject:(NSDictionary*)JsonObj;
+ (BOOL)parseBoolWithKey:(NSString *)key fromJsonObject:(NSDictionary *)JsonObj error:(NSError**)error;
+ (NSArray*)parseArrayOfClass:(Class<JSONEncoding>)objectClass withKey:(NSString*)key fromJsonObject:(NSDictionary*)JsonObj;
+ (NSArray*)parseArrayOfClass:(Class<JSONEncoding>)objectClass fromArray:(NSArray*)array;
+ (NSDictionary*)parseDictionaryOfStringsToClass:(Class<JSONEncoding>)objectClass fromJsonObject:(NSDictionary*)JsonObj;
+ (NSDictionary*)parseDictionaryOfStringsToClass:(Class<JSONEncoding>)objectClass withKey:(NSString*)key fromJsonObject:(NSDictionary *)JsonObj;
+ (NSArray*)parseArrayOfStringsWithKey:(NSString*)key fromJsonObject:(NSDictionary*)JsonObj;
+ (NSString*)parseStringWithKey:(NSString*)key fromJsonObject:(NSDictionary*)JsonObj;
+ (NSDate*)parseDateWithKey:(NSString*)key dateFormat:(NSString*)dateFormat fromJsonObject:(NSDictionary*)jsonObj;
+ (NSDictionary*)parseDictionaryWithKey:(NSString*)key fromJsonObject:(NSDictionary*)JsonObj;

+(NSDictionary *)parseDictionaryOfClass:(Class<JSONEncoding>)keyClass
                                toClass:(Class<JSONEncoding>)objectClass
                                withKey:(NSString*)key
                         fromJsonObject:(NSDictionary *)JsonObj;


+(NSDictionary *)parseDictionaryOfClass:(Class<JSONEncoding>)keyClass
                                toClass:(Class<JSONEncoding>)objectClass
                         fromJsonObject:(NSDictionary *)JsonObj;

+ (NSArray*)jsonifyArrayOfObjects:(NSArray*)array;
+ (NSDictionary*)jsonifyDictionaryOfStringToObject:(NSDictionary*)dictionary;
+ (NSDictionary*)jsonifyDictionaryOfObjectToObject:(NSDictionary*)dictionary;

@end
